﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="ViewPhoto.aspx.cs" Inherits="SAD_Assignment1.Public.ViewPhoto"
    MasterPageFile="~/Shared/Site1.Master" EnableEventValidation="false" %>

<asp:Content ContentPlaceHolderID="head" runat="server">
    <title>View Photo</title>
</asp:Content>

<asp:Content runat="server" ContentPlaceHolderID="ContentPlaceHolder1">
    <div class="container">
        
        <asp:DataList runat="server" DataKeyField="ID" ID="grid" Width="100%">
            <ItemTemplate>
                <asp:HiddenField ID="hiddenPhotoID" runat="server" Value='<%#Eval("Type") %>'/>
                <asp:Button CssClass="btn btn-success" runat="server" Text="Duyệt" Width="150" OnLoad="ApproveBtn_Load" 
                    ID="ApproveBtn" OnCommand="ApproveBtn_Command" Visible="false"/>
                <asp:Button CssClass="btn btn-success" runat="server" Text="Xóa" Width="150" OnLoad="DeletePhotoBtn_Load" 
                    ID="DeletePhotoBtn" OnCommand="DeletePhotoBtn_Command" Visible="false" style="float:right"
                    CommandArgument='<%#Eval("URL") %>'/>                
                <h3 style="font-weight: bold">
                    <%# DataBinder.Eval(Container.DataItem,"Title") %>
                </h3>
                <div>
                    Đăng bởi <asp:HyperLink runat="server" NavigateUrl='<%#SAD_Assignment1.Shared.Resource.UserInfo+"?ID="+Eval("AccID") %>' 
                        Target="_blank" Text='<%#DataBinder.Eval(Container.DataItem,"AccName") %>'/>                    
                    vào lúc <%#DataBinder.Eval(Container.DataItem,"PostDate") %>
                    
                </div>
                <div>
                    <asp:Button CssClass="btn btn-info" Text="Thích" runat="server" ID="LikeBtn" OnCommand="LikeBtn_Command"
                        CommandArgument='<%#Eval("ID")%>' OnLoad="LikeBtn_Load"/>
                    Số người thích: <asp:Label runat="server" ID="likeCountLB" Text="0" OnLoad="likeCountLB_Load" />
                </div>
                <div>
                    <asp:Button CssClass="btn btn-info" Text="Không Thích" runat="server" ID="UnlikeBtn" OnCommand="UnlikeBtn_Command"
                        CommandArgument='<%#Eval("ID")%>' OnLoad="UnlikeBtn_Load"/>
                    Số người không thích: <asp:Label runat="server" ID="unlikeCountLB" Text="0" OnLoad="unlikeCountLB_Load" />
                </div>
                <div class="row">
                    <div style="width: 80%; margin-left: 10%;">
                        <asp:HyperLink ImageUrl='<%#DataBinder.Eval(Container.DataItem,"URL") %>'
                            NavigateUrl="#" CssClass="thumbnail" runat="server" />
                    </div>
                </div>
            </ItemTemplate>
        </asp:DataList>

        <asp:Panel runat="server" ID="loginRequire">
            <span>Bạn cần
                <asp:HyperLink ID="loginHL" runat="server" Text="Đăng nhập" />
                để gửi bình luận
            </span>
        </asp:Panel>
        <asp:Panel runat="server" ID="cmtPanel">
            <div class="comment">
                <asp:HyperLink ID="userInfoHL" runat="server" NavigateUrl="#" Target="_blank" />
                <asp:TextBox ID="txtCmtBody" runat="server" TextMode="MultiLine" Width="100%" CssClass="form-control" Text="" />
                <asp:Button ID="sendCmtBtn" runat="server" Text="Gửi bình luận" OnCommand="sendCmtBtn_Command" CssClass="btn btn-info" />
            </div>
        </asp:Panel>

        <asp:DataList runat="server" ID="cmtGrid" Width="100%">
            <ItemTemplate>

                <div class="<%#CmtCSS((bool)Eval("IsReply")) %>">
                    <asp:HyperLink ID="HyperLink5" runat="server" NavigateUrl='<%#SAD_Assignment1.Shared.Resource.UserInfo+"?ID="+Eval("AccID") %>' 
                        Target="_blank" Text='<%#DataBinder.Eval(Container.DataItem,"AccName") %>' />
                    gửi vào lúc <%#DataBinder.Eval(Container.DataItem,"PostDate") %>
                    <asp:Button ID="DeleteBtn" runat="server" CssClass="btn btn-info" Text="Xóa" Style="float: right;"
                        Visible='<%#DeleteVisible((int)Eval("AccID")) %>' OnCommand="DeleteBtn_Command"
                        CommandArgument='<%#Eval("ID") %>' CommandName='<%#CmdName((bool)Eval("IsReply")) %>'/>
                    <p>
                        <%#DataBinder.Eval(Container.DataItem,"Body") %>
                    </p>                    
                </div>
                <asp:Button ID="replyBtn" runat="server" Text="Trả lời" Visible='<%#!(bool)Eval("IsReply") %>' 
                    CssClass="btn btn-info" OnCommand="replyBtn_Command" CommandArgument='<%#Container.ItemIndex %>'
                    OnLoad="replyBtn_Load"/>
                <asp:Panel runat="server" ID="replyPanel" Visible="false">
                    <div class="comment reply">
                        <asp:HiddenField runat="server" ID="hiddenID" Value='<%#Eval("ID") %>' />
                        <asp:HyperLink ID="userInfoHL2" runat="server" NavigateUrl="#" Target="_blank" />
                        <asp:TextBox ID="txtReplyBody" runat="server" TextMode="MultiLine" Width="100%" CssClass="form-control" Text="" />
                        <asp:Button ID="sendReplyBtn" runat="server" Text="Gửi trả lời" OnCommand="sendReplyBtn_Command" 
                            CssClass="btn btn-info" CommandArgument='<%#Container.ItemIndex %>'/>
                    </div>
                </asp:Panel>                
            </ItemTemplate>
        </asp:DataList>

    </div>
</asp:Content>
